


<script>

    
function loadImage(url,cb){
return new Promise((resolve,reject)=>{ 
   const img=document.createElement('img')
   img.src=url
   img.onload=()=>resolve(img)
   img.onerror=(e)=>reject(['载入错误',e])
 })
}
let url='https://tva1.sinaimg.cn/large/008i3skNgy1gvzs6fhdomj30p00dw0tq.jpg'

loadImage(url)
.then(
  (img)=>{document.body.append(img)
    // (e)=>{console.log(e)}
  })
.catch((e)=>{console.log(e);})





</script>